#!/bin/bash

project="$1"

if [ -z $project ]; then
    echo "missing project name"
    exit 128
fi

mkdir -p $project/src/main/java
mkdir -p $project/src/main/resources
mkdir -p $project/src/test/java
mkdir -p $project/src/test/resources

cat > $project/pom.xml << EOF
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <parent>
        <artifactId>xxx</artifactId>
        <groupId>xxx.xxx</groupId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>..</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <url>http://maven.apache.org</url>

    <artifactId>xxx</artifactId>
	<packaging>jar</packaging>
	<name>\${project.artifactId}</name>

	<properties>
        <maven.compiler.source>1.7</maven.compiler.source>    
        <maven.compiler.target>1.7</maven.compiler.target>    
        <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
        <maven.test.skip>true</maven.test.skip>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <dependencies>

		<!-- test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

	<build>
        <plugins>
        </plugins>
	</build>

</project>
EOF
